<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="root" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>闲情偶寄|写博客</title>
<link rel="stylesheet" href="${root}/me/css/wirte-style.css" />
<link rel="stylesheet" href="${root}/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="${root}/editor/css/editormd.css" />
<script type="text/javascript" src="${root}/editor/js/jquery.min.js"></script>
<script type="text/javascript" src="${root}/editor/js/editormd.min.js"></script>
<script type="text/javascript" src="${root}/me/js/frame.js"></script>
<script type="text/javascript">
	var testEditor;

	$(function() {
		testEditor = editormd("test-editormd", {
			width : "95%",
			height : 600,
			syncScrolling : "single",
			path : "${root}/editor/lib/",
			tex : true, // 默认不解析
			flowChart : true, // 默认不解析
			sequenceDiagram : true,
			saveHTMLToTextarea : true,
			/**上传图片相关配置如下*/
			imageUpload : true,
			imageFormats : [ "jpg", "jpeg", "gif", "png", "bmp", "webp" ],
			imageUploadURL : "${root}/manager/article/picture"//注意你后端的上传图片服务地址

		});

	});
</script>
<!-- <script type='text/javascript' charset='UTF-8' src='https://www.xianliao.me/embed.js'></script> -->
</head>

<body>
	<header class="header">
		<a href="index.html">
			<p>SaiyaEmon | Blog</p>
		</a>
	</header>
	<div class="editor">
		<form action="${root}/manager/article/save" method="post">
		<input type="hidden" name="id" value="${articleInformation.article.id }">
			<input type="text" name="title" placeholder="请输入文章标题"
				value="${articleInformation.article.title }" />
			<select name="categoryId">
				<option>--选择类型--</option>
				<c:forEach var="category" items="${categories }">
					 <c:if test="${category.id eq articleInformation.article.categoryId }">
						<option value="${category.id }" selected="selected">${category.name }</option>
					</c:if>
				<c:if test="${!(category.id eq articleInformation.article.categoryId) }"> 
						<option value="${category.id }">${category.name }</option>
					 </c:if> 
				</c:forEach>
			</select>
			<input type="text" name="tags" placeholder='请输入文章标签，用 “ , ” 隔开'
				value="${tags }" />
			<input type="submit" value="提交" />
			<input type="button" value="保存" />
			<div style="width: 95%;height: 50px;margin: 0 auto;clear:left;">			
				<textarea style="width: 100%;"  name="summary" placeholder="请输入摘要">${articleInformation.article.summary}</textarea>
			</div>
			<div class="editormd" id="test-editormd">
				<textarea id="my-editormd-markdown-doc" class="editormd-markdown-textarea" name="markdown">${articleInformation.article.markdown }</textarea>
				<!-- 第二个隐藏文本域，用来构造生成的HTML代码，方便表单POST提交，这里的name可以任意取，后台接受时以这个name键为准 -->
				<textarea id="my-editormd-html-code" class="editormd-html-textarea" name="content"></textarea>
			</div>
		</form>
	</div>


</body>

</html>